<%@ page language="java" import="java.util.*" import="orm.*" pageEncoding="utf-8" errorPage="errorPage.jsp"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
	List paper = (List)session.getAttribute("paper");
	Set errQuestion = (Set)session.getAttribute("errQues");
	String s_total = (String)request.getAttribute("s_total");
	String om_total = (String)request.getAttribute("om_total");
	String grade = (String)session.getAttribute("grade");
	int[] score = (int[])session.getAttribute("score");
	System.out.println(errQuestion.size());
	session.removeAttribute("paper");
	session.removeAttribute("errQues");
	session.removeAttribute("grade");
	session.removeAttribute("score");
	session.removeAttribute("test");
	
 %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html lang="true">
  <head>
    <html:base />
    
    <title>考试结果</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
<script language=javascript>
    function keydown(){
	   if(event.keyCode==8){
		    event.keyCode=0;
		    event.returnValue=false;
	    }if(event.keyCode==13){
		    event.keyCode=0;
		    event.returnValue=false;
	    }if(event.keyCode==116){
		    event.keyCode=0;
		    event.returnValue=false;
	    }if((event.altKey)&&((window.event.keyCode==37)||(window.event.keyCode==39))){
		   event.returnValue=false;
	    }if((event.ctrlKey)&&(event.keyCode==78)){
	       event.returnValue=false;
	    }if((event.shiftKey)&&(event.keyCode==121)){
	       event.returnValue=false;
	     }if(event.keyCode==27){
		    event.keyCode=0;
		    event.returnValue=false;
           }
      }
     function click() {
         event.returnValue=false;
      }
     document.oncontextmenu=click;
  </script>
  </head>
  
  <body style="background-color: #efe8ef;" onkeydown="keydown()">
  	<br /><br />
    <center>
    <font size="6">本次考试的客观题部分的成绩为：</font><br /><br />
    <font color="red" size="20"><%=grade %></font><br/><br /></center>
    <strong><font size="5">一.单选题</font></strong>
    (总分  <%=String.valueOf(score[0])%>, 得分  <font color="red"><%=s_total %></font>)<br /><br />
    	<table border="0" cellspacing="0" cellpadding="0">
           <%for(int i = 0; i < paper.size(); i++){
             	Map tempKnow = (Map)paper.get(i);
             	short subscore = ((Short)tempKnow.get("subscore")).shortValue();
             	List sub = (List)tempKnow.get("sub");
             	for (int j = 0; j < sub.size(); j++){
             		Question q = (Question)sub.get(j);
             		if (j % 5 == 0){
           %>
	          <tr><%} %><td>
	               <font  size="4"><strong><%=String.valueOf(j + 1) %>.</strong>
	               (<%=String.valueOf(subscore) %>分)</font>
	          </td>
	          <td><% if (errQuestion.contains(q)){ %>
	          <font color="red" size="6">×</font><%}else{ %>
	          <strong><font size="5">√</font></strong><%} %></td>
	          <%if (j % 5 == 0){ %></tr>   
             <% } } }%></table>
             <br />
             <strong><font size="5">二.多选题</font></strong>
             (总分  <%=String.valueOf(score[1])%>, 得分  <font color="red"><%=om_total %></font>)<br /><br />
             <table border="0" cellspacing="0" cellpadding="0">
             <% for (int i = 0; i < paper.size(); i++){ 
             		Map tempKnow = (Map)paper.get(i);
             		short objmulscore = ((Short)tempKnow.get("objmulscore")).shortValue();
             		List objmul = (List)tempKnow.get("objmul");
             		for (int j = 0; j < objmul.size(); j++){
             			Question q = (Question)objmul.get(j);
             			if (j % 5 == 0){
             %>
	          <tr><%} %><td>
	               <font size="4"><strong><%=String.valueOf(j + 1) %>.</strong>
	               (<%=String.valueOf(objmulscore) %>分)</font>
	          </td>
	          <td><% if (errQuestion.contains(q)){ %>
	          <font color="red" size="6">×</font><%}else{ %>
	          <strong><font size="5">√</font></strong><%} %></td>
	           <%if (j % 5 == 0){ %></tr> 
             <% }}} %></table><br />
             <strong><font size="5">三.主观题</font></strong> 
             (总分  <%=String.valueOf(score[2])%>)(请等待老师批阅)<br /><br />
             <table border="0" cellspacing="0" cellpadding="0">
             <% for (int i = 0; i < paper.size(); i++){ 
             		Map tempKnow = (Map)paper.get(i);
             		short objscore = ((Short)tempKnow.get("objscore")).shortValue();
             		List obj = (List)tempKnow.get("obj");
             		for (int j = 0; j < obj.size(); j++){
             			if (j % 5 == 0){
             %>
	          <tr><%} %><td>
	          	<font size="4"><strong><%=String.valueOf(j + 1) %>.</strong>
	          	(<%=String.valueOf(objscore) %>分)</font>
	          </td><td><strong><font size="5">？</font></strong></td>
	          <%if (j % 5 == 0){ %></tr>    
             <%}}}%></table>
  </body>
</html:html>
